package com.gxa.system_setting.controller;

import com.gxa.common.R;
import com.gxa.common.entity.system_settings.BadWeather;
import com.gxa.system_setting.service.BadWeatherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
public class BadWeatherController {

    @Autowired
    private BadWeatherService badWeatherService;
    //分页查询
    @GetMapping("/queryBadWeatherList")
    public R queryBadWeatherList(Integer currentPage,Integer pageSize){
        return badWeatherService.queryBadWeatherList(currentPage,pageSize);
    }

    //编辑，根据操作修改状态码
    //0未生效；1生效中；2已结束;3已停用
    @PostMapping("/updateBadWeather")
    public R updateBadWeather(@RequestBody BadWeather badWeather){
        return  badWeatherService.updateBadWeather(badWeather);
    }

    //停用 将status的1变为3
    @PostMapping("/stopBadWeather")
    public R stopBadWeather(@RequestBody BadWeather badWeather){
        return badWeatherService.stopBadWeather(badWeather);
    }

    //重新发布 将状态2或者3改变为1，并且传入时间
    @PostMapping("/againPut")
    public R againPut(@RequestBody BadWeather badWeather){
       return badWeatherService.againPut(badWeather);
    }

    //条件查询
    @PostMapping("/queryByConditions")
    public R queryByConditions(@RequestBody Map map){
        return badWeatherService.queryByConditions(map);
    }


}
